<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd">

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html xmlns="http://www.w3.org/1999/xhtml" lang = "zh-CN">
<head>
	<title>一里课堂微信管理平台</title>
	<meta
 http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta name="decorator" content="login"/>
	 <style type="text/css">
    	body{
    		width:100%;
    		text-align: center;
    	}
   	 </style>
</head>

<body>
   <div class="login_wapper">
        <div class="login_title">
           
        </div>
        <div class="content">
            <div class="user">
                <form onsubmit="return load();" method="post" id="loginForm" name="loginForm" >
                
	                <input type="text" class="username"   name = "userName" placeholder="请输入您的登录账号邮箱" required="false">
	
	                <input type="password" class="password" name="password" placeholder="请输入您的登录密码">
	                   <div class="login_height">
	                	 <p  class="warnning"></p>	                   
	                   </div>
	                <input type="submit" name="submit" class="login_btn" value="登 录" />
                </form>
            </div>
            <p class="login_footer">Copyright 2012 - 2017 京ICP备11044246号</p>
        </div>
    </div>
    <script type="text/javascript">
    	$("input[name='userName']").focus();
		function load(){
			if($("input[name='userName']").val()==""||$("input[name='password']").val()==""){
        		$(".warnning").text("用户名或密码不可为空");
        		return false;
			}
 			$("input[name='submit']").addClass("btn_grey");
 			$("input[name='submit']").val("登 录 中");
			$("input[name='submit']").attr("disabled",true);
			$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: '${ctx}/sys/login',
		        data: {"userName": $("input[name='userName']").val(),"password":$("input[name='password']").val(),tm:new Date().getTime()},
		        success: function (data) {
		 			$("input[name='submit']").removeClass("btn_grey");
		        	$("input[name='submit']").attr("disabled",false);
		 			$("input[name='submit']").val("登 录");
		        	if(data.status!='0'){
		        		$(".warnning").text(data.error);
		        		return false;
		        	}
		        	//alert(data.data);
		        	window.location.href = '${ctx}'+ data.data;
		        	return false;
	        	},
		        error: function(data) {
		 			$("input[name='submit']").removeClass("btn_grey");
		        	$("input[name='submit']").attr("disabled",false);
		 			$("input[name='submit']").val("登 录");
	        		$(".warnning").text(msg.error);
		        }
		    });
        	return false;
		}
	</script>
</body>
</html>
